/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ultrasoft.farmasoft.domain;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Administrador
 */
@Entity
@Table(name = "acquittance")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Acquittance.findAll", query = "SELECT a FROM Acquittance a"),
    @NamedQuery(name = "Acquittance.findByAcquittanceId", query = "SELECT a FROM Acquittance a WHERE a.acquittanceId = :acquittanceId"),
    @NamedQuery(name = "Acquittance.findByDate", query = "SELECT a FROM Acquittance a WHERE a.date = :date"),
    @NamedQuery(name = "Acquittance.findByNumber", query = "SELECT a FROM Acquittance a WHERE a.number = :number"),
    @NamedQuery(name = "Acquittance.findByClient", query = "SELECT a FROM Acquittance a WHERE a.client = :client"),
    @NamedQuery(name = "Acquittance.findByAmount", query = "SELECT a FROM Acquittance a WHERE a.amount = :amount"),
    @NamedQuery(name = "Acquittance.findByActive", query = "SELECT a FROM Acquittance a WHERE a.active = :active")})
public class Acquittance implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "acquittanceId")
    private Integer acquittanceId;
    @Basic(optional = false)
    @Column(name = "date")
    @Temporal(TemporalType.TIMESTAMP)
    private Date date;
    @Basic(optional = false)
    @Column(name = "number")
    private int number;
    @Basic(optional = false)
    @Column(name = "client")
    private boolean client;
    @Basic(optional = false)
    @Column(name = "amount")
    private float amount;
    @Basic(optional = false)
    @Column(name = "active")
    private boolean active;
    @OneToMany(mappedBy = "acquittanceId")
    private Collection<Transaction> transactionCollection;
    @JoinColumn(name = "pharmacyId", referencedColumnName = "pharmacyId")
    @ManyToOne
    private Pharmacy pharmacyId;

    public Acquittance() {
    }

    public Acquittance(Integer acquittanceId) {
        this.acquittanceId = acquittanceId;
    }

    public Acquittance(Integer acquittanceId, Date date, int number, boolean client, float amount, boolean active) {
        this.acquittanceId = acquittanceId;
        this.date = date;
        this.number = number;
        this.client = client;
        this.amount = amount;
        this.active = active;
    }

    public Integer getAcquittanceId() {
        return acquittanceId;
    }

    public void setAcquittanceId(Integer acquittanceId) {
        this.acquittanceId = acquittanceId;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public int getNumber() {
        return number;
    }

    public void setNumber(int number) {
        this.number = number;
    }

    public boolean getClient() {
        return client;
    }

    public void setClient(boolean client) {
        this.client = client;
    }

    public float getAmount() {
        return amount;
    }

    public void setAmount(float amount) {
        this.amount = amount;
    }

    public boolean getActive() {
        return active;
    }

    public void setActive(boolean active) {
        this.active = active;
    }

    @XmlTransient
    public Collection<Transaction> getTransactionCollection() {
        return transactionCollection;
    }

    public void setTransactionCollection(Collection<Transaction> transactionCollection) {
        this.transactionCollection = transactionCollection;
    }

    public Pharmacy getPharmacyId() {
        return pharmacyId;
    }

    public void setPharmacyId(Pharmacy pharmacyId) {
        this.pharmacyId = pharmacyId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (acquittanceId != null ? acquittanceId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Acquittance)) {
            return false;
        }
        Acquittance other = (Acquittance) object;
        if ((this.acquittanceId == null && other.acquittanceId != null) || (this.acquittanceId != null && !this.acquittanceId.equals(other.acquittanceId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.ultrasoft.farmasoft.domain.Acquittance[ acquittanceId=" + acquittanceId + " ]";
    }
    
}
